<!DOCTYPE html>
<html>
<head>
    <title>生成文章</title>
    <#include "/header.html">
    <!-- 引入相关js文件 -->
    <script type="text/javascript" charset="utf-8" src="${request.contextPath}/statics/plugins/edit135/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${request.contextPath}/statics/plugins/edit135/third-party/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${request.contextPath}/statics/plugins/edit135/ueditor.all.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${request.contextPath}/statics/plugins/edit135/a92d301d77.js"></script>
    <!-- 引入相关css文件 -->
    <link rel="stylesheet" type="text/css" href="${request.contextPath}/statics/plugins/edit135/themes/96619a5672.css"/>

</head>
<body>
<style>
    th {
        text-align: center;
    }
</style>
<div id="rrapp" v-cloak>
    <div class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-10 control-label">
                    <input type="text" class="form-control" v-model="weiXinUrl"
                           placeholder="请把文章链接粘贴到这里" id="weiXinUrl" style="margin-left: 15px"/>
                </div>
                <div class="col-sm-2 control-label">
                    <input :disabled="disabled" type="button" class="btn btn-primary" value="生成" @click="getWeiXinPage" style="width: 115%"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-6 control-label">
                    <input list="editBrandNames" placeholder="选择品牌"
                           class="form-control" id="articleBrandName">
                    <datalist id="editBrandNames">
                    </datalist>
                </div>
                <div class="col-sm-6 control-label">
                    <input list="editTypeNames" placeholder="选择分类"
                           class="form-control" id="articleTypeName">
                    <datalist id="editTypeNames">
                    </datalist>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-12 control-label">
                    <input type="text" class="form-control" v-model="bArticleInfo.articleTitle"
                           placeholder="从链接中提取的标题将显示在这里" id="articleTitle"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-12">
                    <div class="form-group">
                        <script id="editor" type="text/plain" style="width:1024px;"></script>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                <input type="button" class="btn btn-warning" @click="closeInfo" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/sys/webspider.js?_${.now?long}"></script>
<script>
    var appkey = '5e0d699a-3170-4210-b676-6dbbac10c65d';
    window.BASEURL = 'http://www.135editor.com';
    window.UEDITOR_HOME_URL = "/ueditor/jsp/upload/image/";
    window.current_editor = UE.getEditor('editor', {
        plat_host: 'www.135editor.com',
        appkey: appkey, open_editor: true, pageLoad: true,
        style_url: BASEURL + '/editor_styles/open?inajax=1&appkey=' + appkey,
        style_width: 340,
        uploadFormData: {'referer': window.document.referrer},
        initialFrameHeight: 680,
        zIndex: 1000,
        focus: true,
        autoFloatEnabled: false, autoHeightEnabled: false, scaleEnabled: false,
        focusInEnd: true
    });

    //编辑器加载完成之后
    window.current_editor.addListener('ready', function (editor) {
        // var url = location.search;
        // var articleId = url.split("=")[1];
        // if (articleId != 0) {
        //     loadData(articleId);
        // }
    });

    function loadData(e) {
        console.log("e:" + e);
        $.get(baseURL + "sys/barticleinfo/info/" + e, function (r) {
            vm.bArticleInfo = r.bArticleInfo;
            window.current_editor.setContent(r.bArticleInfo.articleContent);
        })
    }

    $(function () {
        // $.ajax({
        //     type: "POST",
        //     async:false,
        //     url: baseURL + 'sys/buserinfo/getUserGzhList',
        //     contentType: "application/json",
        //     success: function(r){
        //         if(r.code==0){
        //             //vm.bbrandinfo=r.brandInfo;
        //             $("#selectUserGzhList").append(
        //                 "<option selected='selected' value='-1'>全部平台</option>");
        //             for(var i=0;i<r.userGzhList.length;i++){
        //                 $("#selectUserGzhList").append(
        //                     "<option value=" + r.userGzhList[i].gzhCode +">"+ r.userGzhList[i].gzhName+"</option>");
        //             }
        //         }
        //     }
        // });

        $.ajax({
            type: "POST",
            async:false,
            url: baseURL + 'sys/bbrandinfo/queryAll',
            contentType: "application/json",
            success: function(r){
                if(r.code==0){
                    vm.bbrandinfo=r.brandInfo;

                    for(var i=0;i<r.brandInfo.length;i++){
                        $("#editBrandNames").append(
                            "<option value=" + r.brandInfo[i].brandName +">"+"</option>");
                    }
                }
            }
        });

        $.ajax({
            type: "POST",
            async:false,
            url: baseURL + 'sys/barticletypeinfo/queryAll',
            contentType: "application/json",
            success: function(r){
                if(r.code==0){
                    //vm.bbrandinfo=r.brandInfo;
                    for(var i=0;i<r.barticletypeinfo.length;i++){
                        $("#editTypeNames").append(
                            "<option value=" + r.barticletypeinfo[i].articleTypeName +">"+"</option>");
                    }
                }
            }
        });

    })
</script>
</body>
</html>
